package com.imtimmy.android.whichone;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public final class DatabaseHelper extends SQLiteOpenHelper {
	public static final String DATABASE_NAME = "whichone.db";
	public static final int DATABASE_VERSION = 2;
	public static final String TABLE_NAME = "restaurant";

	DatabaseHelper(Context paramContext) {
		super(paramContext, DATABASE_NAME, null, DATABASE_VERSION);
	}

	public void onCreate(SQLiteDatabase paramSQLiteDatabase) {
		paramSQLiteDatabase.execSQL("CREATE TABLE " + TABLE_NAME
				+ " (id INT PRIMARY KEY, name VARCHAR(100))");
		paramSQLiteDatabase.execSQL("INSERT INTO " + TABLE_NAME
				+ "(name) values('红火年代')");
		paramSQLiteDatabase.execSQL("INSERT INTO " + TABLE_NAME
				+ "(name) values('吉川日本菜')");
		paramSQLiteDatabase.execSQL("INSERT INTO " + TABLE_NAME
				+ "(name) values('华必和')");
		paramSQLiteDatabase.execSQL("INSERT INTO " + TABLE_NAME
				+ "(name) values('一口田')");
		paramSQLiteDatabase.execSQL("INSERT INTO " + TABLE_NAME
				+ "(name) values('不吃，省钱！')");
	}

	public void onUpgrade(SQLiteDatabase paramSQLiteDatabase, int paramInt1,
			int paramInt2) {
		paramSQLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(paramSQLiteDatabase);
	}
}